<?php
declare (strict_types = 1);
namespace app\api\controller;
use app\api\BaseController;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use think\facade\Db;
use think\facade\Request;

class Index extends BaseController
{
	protected $middleware = [
    	
    ];
	// 调用学校接口
	public function index(){
		// 查找首页轮播
		$result=Db::name('school')
		->where(['status'=>1,'type'=>2])
		->order('create_time asc')
		->select()
		->toArray();
		if($result){
			return json(['code'=>200,'msg'=>'请求成功','data'=>$result]);
		}else{
			return json(['code'=>404,'msg'=>'数据不存在']);
		}
		
	}
	public function agreement(){
		$wechat=xn_cfg('wechat');
		return json(['code'=>200,'msg'=>'请求成功','data'=>$wechat]);
	}
	public function zudays(){
		$data=xn_cfg('settings');
		// print_r($data);
		$res=$data['datetime'];
		$res=explode(',',$res);
		if($res){
			foreach ($res as $item) {
			    if (strpos($item, ':') !== false) {
			        $parts = explode(':', $item, 2); // 限制分割次数
			        if (is_numeric($parts[1])) {
						// echo $parts[1];
			            $result[] = ['value' => (int)$parts[1]];
			        }
			    }
			}
			return json(['code'=>200,'msg'=>'请求成功','data'=>$result]);
		}
		// return json(['code'=>200,'msg'=>'请求成功','data'=>$info]);
	}
}
